package com.young.coderule.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.young.coderule.entity.ComCodeRuleNumber;
import com.young.coderule.mapper.ComCodeRuleNumberMapper;
import com.young.coderule.service.CodeRuleCacheService;
import com.young.coderule.service.ComCodeRuleNumberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * @DESCRIPTION: 最大流水号service
 * @USER: Young
 */
@Service
public class ComCodeRuleNumberServiceImpl extends ServiceImpl<ComCodeRuleNumberMapper, ComCodeRuleNumber> implements ComCodeRuleNumberService {

    @Autowired
    private CodeRuleCacheService codeRuleCacheService;

	@Override
    public void add(ComCodeRuleNumber comCodeRuleNumber) {
        this.save(comCodeRuleNumber);
        codeRuleCacheService.putCodeRuleNumber(comCodeRuleNumber.getBizObjectCode(),comCodeRuleNumber);
    }

    @Override
    public void edit(ComCodeRuleNumber comCodeRuleNumber) {
        this.updateById(comCodeRuleNumber);
        codeRuleCacheService.putCodeRuleNumber(comCodeRuleNumber.getBizObjectCode(),comCodeRuleNumber);

    }

}